package com.example.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.RedisSerializer;

/**
 * @author: 临晖
 * @since: 2024-04-17
 */

@Configuration
public class RedisTemplateConfig {


    @Bean
    public RedisTemplate getRedisTemplate(RedisConnectionFactory rct) {
        RedisTemplate<String, Object> rt = new RedisTemplate<>();
        rt.setConnectionFactory(rct);
        rt.setKeySerializer(RedisSerializer.string());
        return rt;
    }

}
